import _ from 'lodash';

/*
* 菜单数据
* */
export const menu = [
    {
        name: '店铺信息',
        code: 'store',
        url: '/store/info',
        ico: 'home',
    },
    {
        name: '店铺管理',
        code: 'store',
        ico: 'home',
        children: [
            {
                name: '人员管理',
                code: 'employee',
                url: '/store/employee',
                ico: 'team',
            },
            {
                name: '设备管理',
                code: 'device',
                url: '/store/device',
                ico: 'hdd',
            },
        ],
    },
    {
        name: '财务管理',
        code: 'finance',
        ico: 'bank',
        children: [
            {
                name: '收入明细',
                code: 'income',
                url: '/financial/orders'
            },
            {
                name: '收入报表',
                code: 'sale',
                url: '/financial/income'
            },
            {
                name: 'VIP卡管理',
                code: 'vipCard',
                url: '/financial/cards'
            },
        ]
    },
    {
        name: '运营报表',
        code: 'operate',
        ico: 'pie-chart',
        children: [
            {
                name: '游戏运行报表',
                ico: 'bar-chart',
                code: 'games',
                url: '/analysis/games'
            },
            {
                name: '设备运行报表',
                ico: 'line-chart',
                code: 'devices',
                url: '/analysis/devices'
            },
        ]
    },
];

/*
* 订单数据
* */
export const ORDERS = [
    {
        id: 'order_0000',
        code: 'order_index_0000',
        payTypeId: '',              // 支付类型 id
        payTypeName: '微信支付',     // 支付类型名称
        payUserId: '',              // 支付者 id
        payUserName: '三牙西瓜',     // 支付者昵称
        payUserAvatar: '',          // 支付者头像
        amount: '35',               // 支付金额
        payTime: '2017-10-10 10:10:10', // 支付时间utc
        transactionTypeId: '',          // 交易类型 id
        transactionTypeName: '充值',     // 交易类型名称
        storeId: ' storeId_000',        // 关联店铺 id
        storeName: 'zhang_san_vr_club', // 关联店铺名称
    },
    {
        id: 'order_0001',
        code: 'order_index_0001',
        payTypeId: '',              // 支付类型 id
        payTypeName: '线下代收',     // 支付类型名称
        payUserId: '',              // 支付者 id
        payUserName: '店员张三',     // 支付者昵称
        payUserAvatar: '',          // 支付者头像
        amount: '100',               // 支付金额
        payTime: '2017-10-10 10:10:10', // 支付时间utc
        transactionTypeId: '',          // 交易类型 id
        transactionTypeName: '畅玩套餐',     // 交易类型名称
        storeId: ' storeId_000',        // 关联店铺 id
        storeName: 'zhang_san_vr_club', // 关联店铺名称
    },
];

/*
* 收入报表数据
* */
const mockData = ({ codeFix, length, from = 35, to = 5000, name, ...otherValues }) => {
    const n = name.split('*');
    const arr = new Array(length);
    return _.map(arr, (a, i) => {
        const other = {};
        _.forEach(otherValues, (v, k) => {
            other[k] = _.random(from, to);
        });
        return {
            code: `${codeFix}${i}`,
            name: `${n[0]}${i + 1}${n[1]}`,
            ...other
        };
    });
};
export const incomeDataMonth = {
    total: {
        packages: 298,        // 套餐
        storeValue: 100,      // 充值
        all: 1231231,
    },
    info: {
        type: 'month',
        value: '2017-10',
        storeId: 'storeId',
    },
    data: mockData({
        codeFix: 'income_',
        length: 31,
        name: '2017年10月*日',
        to: 1000,
        packages: '',
        storeValue: '',
    })
};
export const incomeDataYear = {
    total: {
        packages: 298,        // 套餐
        storeValue: 100,      // 充值
        all: 1231231,
    },
    info: {
        type: 'year',
        value: '2017',
        storeId: 'storeId',
    },
    data: mockData({
        codeFix: 'income_',
        length: 12,
        name: '2017年*月',
        to: 2000,
        packages: '',
        storeValue: '',
    })
};
export const deviceDataMonth = {
    total: {},
    info: {
        type: 'month',
        value: '2017-10',
        storeId: 'storeId',
    },
    data: mockData({
        codeFix: 'device_',
        length: 31,
        name: '2017年10月*日',
        to: 500,
        d1: '',
        d2: '',
        d3: '',
    })
};
export const deviceDataYear = {
    total: {},
    info: {
        type: 'year',
        value: '2017',
        storeId: 'storeId',
    },
    data: mockData({
        codeFix: 'device_',
        length: 12,
        name: '2017年*月',
        to: 2000,
        d1: '',
        d2: '',
        d3: '',
    })
};
export const gamesDataMonth = {
    info: {
        type: 'month',
        value: '2017-11',
    },
    data: mockData({
        codeFix: 'games_',
        length: 20,
        to: 200,
        name: '游戏名称_*号',
        times: '',
    })
};
export const gamesDataYear = {
    total: {
        packages: 298,        // 套餐
        storeValue: 100,      // 充值
        all: 1231231,
    },
    info: {
        type: 'year',
        value: '2017',
    },
    data: mockData({
        codeFix: 'games_',
        length: 20,
        name: '游戏名称_*号',
        times: '',
    })
};
/*
* vip卡列表
* */

export const vipCards = {
    pagination: {
        page: 1,            // 当前页数
        pageSize: 20,       // 每页显示数量
        total: 100,         // 数据总量(条数)
        pageCount: 5,       // 总页数
    },
    data: [             // 数据
        {
            id: 'card_0000',
            userId: 'useId_0000',
            userName: '三牙西瓜',
            storeId: 'storeId_0000',
            storeName: '进水体验店',
            total: 1200,    // 累计充值金额
            balance: 300,   // 余额
        },
        {
            id: 'card_0001',
            userId: 'useId_0001',
            userName: '张三',
            storeId: 'storeId_0001',
            storeName: '进水体验店',
            total: 1200,    // 累计充值金额
            balance: 300,   // 余额
        },
    ],
};

/*
* 通过店铺 id , 玩家 id获取充值订单列表
* 玩家vip 卡充值明细
* */
export const vipCardDetail = {
    id: 'card_0000',
    userId: 'useId_0001',
    userName: '张三',
    storeId: 'storeId_0001',
    storeName: '进水体验店',
    total: 1200,    // 累计充值金额
    balance: 300,   // 余额
    pagination: {
        page: 1,
        pageSize: 10,
        total: 3,
        pageCount: 1,
    },
    data: [
        {
            id: 'cd_0000',                  // 订单 id
            createDate: '2017-10-10 12:12:12', // 订单生成时间
            orderTypeCode: 'chongzhi',      // 订单类型 code
            orderTypeName: '充值',           // 订单类型名称
            amount: 100,                    // 交易金额
            curBalance: 100,                // 交易完成时的余额
        },
        {
            id: 'cd_0001',                  // 订单 id
            createDate: '2017-10-10 12:12:12', // 订单生成时间
            orderTypeCode: 'chongzhi',      // 订单类型 code
            orderTypeName: '充值',           // 订单类型名称
            amount: 100,                    // 交易金额
            curBalance: 100,                // 交易完成时的余额
        },
        {
            id: 'cd_0002',                  // 订单 id
            createDate: '2017-10-10 12:12:12', // 订单生成时间
            orderTypeCode: 'xiaofei',       // 订单类型 code
            orderTypeName: '消费',           // 订单类型名称
            amount: 100,                    // 交易金额
            curBalance: 100,                // 交易完成时的余额
        },
    ]
};
